// 分类表
const {DataTypes, db } = require("../db");
db.define('category', {
id: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true,comment:'表自增ID'},
tenantId:{type: DataTypes.INTEGER,allowNull:false,comment:'租户ID'}, 
code:{type: DataTypes.STRING(30),defaultValue:(''),comment:'分类编码'}, 
name:{type: DataTypes.STRING(50),allowNull:false,comment:'栏目名称'}, 
pid:{type: DataTypes.SMALLINT,comment:'上级栏目ID'}, 
pidCode:{type: DataTypes.STRING(30),comment:''}, 
typeNumber:{type: DataTypes.STRING(25),comment:'区别(customertype 客户类别,trade 商品分类,supplytype 供应商类别,paccttype 支出类别，raccttype 收入类别,PayMethod 结算方式，ystype 应收类别，yftype应付类别，yfktype应付款类别 )'}, 
space:{type: DataTypes.INTEGER,defaultValue:0,comment:'间距'}, 
catType:{type: DataTypes.STRING(10),defaultValue:(''),comment:'收支出类型   应收/应付'}, 
direct:{type: DataTypes.STRING(10),comment:'借贷方向'}, 
isEnd:{type: DataTypes.INTEGER,defaultValue:0,comment:'是否最后一级'}, 
remark:{type: DataTypes.STRING(255),comment:'备注'}, 
disabled:{type: DataTypes.TINYINT,defaultValue:0,comment:'状态'}, 
sort:{type: DataTypes.SMALLINT,defaultValue:0,comment:'排序'}, 
pinYin:{type: DataTypes.STRING(255),comment:'名字的拼音'}, 
fullName:{type: DataTypes.STRING(255),comment:'科目全名'}, 
allowAdd:{type: DataTypes.TINYINT,defaultValue:0,comment:'允许加下一级'}, 
allowEdit:{type: DataTypes.TINYINT,defaultValue:1,comment:'允许编辑'}, 
allowDel:{type: DataTypes.TINYINT,defaultValue:1,comment:'允许删除'}, 
tempId:{type: DataTypes.INTEGER,comment:'临时转换ID'}, 
searchTxt:{type: DataTypes.STRING(2000),defaultValue:(''),comment:'快速搜索字段'}, 
isDel:{type: DataTypes.INTEGER,defaultValue:0,comment:''}, 
isInit:{type: DataTypes.INTEGER,comment:''}, 
cby:{type: DataTypes.INTEGER,comment:''}, 
ctime:{type: DataTypes.STRING(20),comment:''}, 
uby:{type: DataTypes.INTEGER,comment:''}, 
utime:{type: DataTypes.STRING(20),comment:''}, 
dby:{type: DataTypes.INTEGER,comment:''}, 
dtime:{type: DataTypes.STRING(20),comment:''}, 
ysOryf:{type: DataTypes.INTEGER,defaultValue:0,comment:'1应收2应付'}, 
createdAt:{type: DataTypes.STRING(20),comment:'创建时间'}, 
isDelete:{type: DataTypes.TINYINT,defaultValue:0,comment:'删除 0/1'}, 
fl:{type: DataTypes.STRING(255),comment:'分类  资产|负债|权益|损益'}, 
state:{type: DataTypes.STRING(12),defaultValue:('启用'),comment:'启用|停用'}, 
canHasSub:{type: DataTypes.INTEGER,defaultValue:0,comment:'可以有下级分类'}, 

}, {
    tableName: 'category',
    timestamps: false,
    comment: '分类表',
    indexes:[{"unique":true,"name":"科目名称唯一","fields":["tenantId"," typeNumber"," code"," pid"]}]
});